package com.frank.game.base;

import com.frank.game.tool.GetProperties;
import com.frank.game.tool.Tools;

/**
 * @deprecated:世界
 * @author frank
 * @date 2015年12月15日
 */
public class World {
	/**长度**/
	private int length;
	/**宽度**/
	private int width;
	/**高度**/
	private int height;
	/**区域集合**/
	private Area[][][] areas;

	public World() {
		this.length = (int)Tools.getRandom(
				Integer.valueOf(GetProperties.getPropertieValue("MIN_WORLD_LENGTH")), 
				Integer.valueOf(GetProperties.getPropertieValue("MAX_WORLD_LENGTH")));
		this.width = (int)Tools.getRandom(
				Integer.valueOf(GetProperties.getPropertieValue("MIN_WORLD_WIDTH")), 
				Integer.valueOf(GetProperties.getPropertieValue("MAX_WORLD_WIDTH")));
		this.height = (int)Tools.getRandom(
				Integer.valueOf(GetProperties.getPropertieValue("MIN_WORLD_HEIGHT")), 
				Integer.valueOf(GetProperties.getPropertieValue("MAX_WORLD_HEIGHT")));
		areas = new Area[length][width][height];
	}
	
	public Area getArea(int x, int y, int z) throws Exception{
		if(x < 0 || y < 0 || z < 0 || x > length || y > width || z > height){
			throw new Exception("获取区域时下标超过限制");
		}
		return areas[x][y][z];
	}
	
	public Area[][][] getAreas(){
		return areas;
	}

	public int getLength() {
		return length;
	}
	public int getWidth() {
		return width;
	}
	public int getHeight() {
		return height;
	}

}
